package com.tofacebook.mapper;

import com.tofacebook.model.Emp;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * 持久层
 */
@Repository
public interface EmpMapper {

    //
    @Select("select *  from t_emp where emp_id = #{empId}")
    public Emp getEmpByEmpId(@Param("empId") long empId);

    @Select("select count(emp_id)  from t_emp where emp_name = #{empName}")
    public int getEmpByEmpName(@Param("empName") String empName);

    @Insert("insert into t_emp(emp_name,age,sex) values(#{empName},#{age},#{sex})")
    int saveEmp(Emp emp);
}
